<template>
  <div>
    <div style="float: left">
      <el-button size="small"> 上报 </el-button>
    </div>
    <div style="float: right">
      <el-input
        size="small"
        v-model="obj.province"
        palceholder="请输入内容"
      ></el-input>
    </div>
    <el-table :data="dataList.list" style="width: 100%">
      <el-table-column
        fixed="left"
        align="center"
        prop="id"
        label="编号"
        width="180"
      >
      </el-table-column>
      <el-table-column align="center" prop="country" label="国家" width="180">
      </el-table-column>
      <el-table-column align="center" prop="province" label="省份">
      </el-table-column>
      <el-table-column align="center" prop="city" label="城市">
      </el-table-column>
      <el-table-column align="center" prop="area" label="区"> </el-table-column>
      <el-table-column align="center" prop="confired" label="现有确诊">
      </el-table-column>
      <el-table-column align="center" prop="suspected" label="疑似">
      </el-table-column>
      <el-table-column align="center" prop="dead" label="死亡">
        <template v-slot="scope">
          <el-tag type="danger">{{ scope.row.dead }}</el-tag>
        </template>
      </el-table-column>
      <el-table-column align="center" prop="cure" label="治愈">
        <template v-slot="scope">
          <el-tag type="success">{{ scope.row.cure }}</el-tag>
        </template>
      </el-table-column>
      <el-table-column align="center" prop="severe" label="累计确诊">
      </el-table-column>
      <el-table-column align="center" prop="outside" label="境外输入">
      </el-table-column>
      <el-table-column
        fixed="right"
        align="center"
        prop="inputTime"
        label="录入时间"
        width="180px"
      >
        <template v-slot="scope">
          <el-tag type="inpuTime">{{ scope.row.inputTime | dateFMT }}</el-tag>
        </template>
      </el-table-column>
    </el-table>
    <el-pagination
      layout="prev, pager, next"
      :total="dataList.total"
      :page-size="obj.pageSize"
      :current-page="obj.page"
      @current-change="change_page"
    >
    </el-pagination>
  </div>
</template>

<script>
import { mapActions, mapState } from "vuex";
export default {
  //计算属性
  computed: {
    //从dataList.js文件的state中获取dataList变量
    ...mapState("dataList", ["dataList"]),
  },
  watch: {
    obj: {
      handler: function () {
        this.page_query(this.obj);
      },
      deep: true,
    },
  },
  data() {
    return {
      obj: {
        page: 1,
        pageSize: 4,
      },
      total: 0,
    };
  },
  created() {
    this.page_query(this.obj);
  },
  methods: {
    ...mapActions("dataList", ["page_query"]),
    change_page(val) {
      this.obj.page = val;
    },
  },
};
</script>
